// import com.alibaba.druid.sql.ast.SQLExpr;
// import com.alibaba.druid.sql.ast.SQLName;
// import com.alibaba.druid.sql.ast.SQLObject;
// import com.alibaba.druid.sql.ast.expr.SQLLiteralExpr;
// import com.alibaba.druid.sql.dialect.mysql.visitor.MySqlASTVisitor;

// import java.util.ArrayList;
// import java.util.List;

#include "MySqlLoadDataInFileStatement.h"
#include "../../../../ast/SQLExpr.h"
#include "../../../../ast/SQLName.h"
#include "../../../../ast/SQLObject.h"
#include "../../../../ast/expr/SQLLiteralExpr.h"
#include "../../visitor/MySqlASTVisitor.h"
#include "../../../../../utils/listTran.h"

MySqlLoadDataInFileStatement::MySqlLoadDataInFileStatement()
{
  setList = std::make_shared<std::list<SQLExpr_ptr>>();
  columns = std::make_shared<std::list<SQLExpr_ptr>>();
}
BOOL_ptr MySqlLoadDataInFileStatement::isLowPriority()
{
  return lowPriority;
}

void MySqlLoadDataInFileStatement::setLowPriority(BOOL_ptr lowPriority)
{
  this->lowPriority = lowPriority;
}

BOOL_ptr MySqlLoadDataInFileStatement::isConcurrent()
{
  return concurrent;
}

void MySqlLoadDataInFileStatement::setConcurrent(BOOL_ptr concurrent)
{
  this->concurrent = concurrent;
}

BOOL_ptr MySqlLoadDataInFileStatement::isLocal()
{
  return local;
}

void MySqlLoadDataInFileStatement::setLocal(BOOL_ptr local)
{
  this->local = local;
}

SQLLiteralExpr_ptr MySqlLoadDataInFileStatement::getFileName()
{
  return fileName;
}

void MySqlLoadDataInFileStatement::setFileName(SQLLiteralExpr_ptr fileName)
{
  this->fileName = fileName;
}

BOOL_ptr MySqlLoadDataInFileStatement::isReplicate()
{
  return replicate;
}

void MySqlLoadDataInFileStatement::setReplicate(BOOL_ptr replicate)
{
  this->replicate = replicate;
}

BOOL_ptr MySqlLoadDataInFileStatement::isIgnore()
{
  return ignore;
}

void MySqlLoadDataInFileStatement::setIgnore(BOOL_ptr ignore)
{
  this->ignore = ignore;
}

SQLName_ptr MySqlLoadDataInFileStatement::getTableName()
{
  return tableName;
}

void MySqlLoadDataInFileStatement::setTableName(SQLName_ptr tableName)
{
  this->tableName = tableName;
}

string_ptr MySqlLoadDataInFileStatement::getCharset()
{
  return charset;
}

void MySqlLoadDataInFileStatement::setCharset(string_ptr charset)
{
  this->charset = charset;
}

SQLLiteralExpr_ptr MySqlLoadDataInFileStatement::getColumnsTerminatedBy()
{
  return columnsTerminatedBy;
}

void MySqlLoadDataInFileStatement::setColumnsTerminatedBy(SQLLiteralExpr_ptr columnsTerminatedBy)
{
  this->columnsTerminatedBy = columnsTerminatedBy;
}

BOOL_ptr MySqlLoadDataInFileStatement::isColumnsEnclosedOptionally()
{
  return columnsEnclosedOptionally;
}

void MySqlLoadDataInFileStatement::setColumnsEnclosedOptionally(BOOL_ptr columnsEnclosedOptionally)
{
  this->columnsEnclosedOptionally = columnsEnclosedOptionally;
}

SQLLiteralExpr_ptr MySqlLoadDataInFileStatement::getColumnsEnclosedBy()
{
  return columnsEnclosedBy;
}

void MySqlLoadDataInFileStatement::setColumnsEnclosedBy(SQLLiteralExpr_ptr columnsEnclosedBy)
{
  this->columnsEnclosedBy = columnsEnclosedBy;
}

SQLLiteralExpr_ptr MySqlLoadDataInFileStatement::getColumnsEscaped()
{
  return columnsEscaped;
}

void MySqlLoadDataInFileStatement::setColumnsEscaped(SQLLiteralExpr_ptr columnsEscaped)
{
  this->columnsEscaped = columnsEscaped;
}

SQLLiteralExpr_ptr MySqlLoadDataInFileStatement::getLinesStartingBy()
{
  return linesStartingBy;
}

void MySqlLoadDataInFileStatement::setLinesStartingBy(SQLLiteralExpr_ptr linesStartingBy)
{
  this->linesStartingBy = linesStartingBy;
}

SQLLiteralExpr_ptr MySqlLoadDataInFileStatement::getLinesTerminatedBy()
{
  return linesTerminatedBy;
}

void MySqlLoadDataInFileStatement::setLinesTerminatedBy(SQLLiteralExpr_ptr linesTerminatedBy)
{
  this->linesTerminatedBy = linesTerminatedBy;
}

SQLExpr_ptr MySqlLoadDataInFileStatement::getIgnoreLinesNumber()
{
  return ignoreLinesNumber;
}

void MySqlLoadDataInFileStatement::setIgnoreLinesNumber(SQLExpr_ptr ignoreLinesNumber)
{
  this->ignoreLinesNumber = ignoreLinesNumber;
}

SQLExpr_list_ptr MySqlLoadDataInFileStatement::getSetList()
{
  return setList;
}

void MySqlLoadDataInFileStatement::accept0(MySqlASTVisitor_ptr visitor)
{
  if (visitor->visit(SharedObject(MySqlLoadDataInFileStatement)))
  {
    acceptChild(visitor, fileName);
    acceptChild(visitor, tableName);
    acceptChild(visitor, columnsTerminatedBy);
    acceptChild(visitor, columnsEnclosedBy);
    acceptChild(visitor, columnsEscaped);
    acceptChild(visitor, linesStartingBy);
    acceptChild(visitor, linesTerminatedBy);
    acceptChild(visitor, ignoreLinesNumber);
    SQLObject_list_ptr tmp = ListTran::tran_class<SQLExpr, SQLObject>(setList);
    acceptChild(visitor, tmp);
  }
  visitor->endVisit(SharedObject(MySqlLoadDataInFileStatement));
}

// @Override
SQLObject_list_ptr MySqlLoadDataInFileStatement::getChildren()
{
  SQLObject_list_ptr children = std::make_shared<std::list<SQLObject_ptr>>();
  if (fileName != nullptr)
  {
    children->push_back(fileName);
  }
  if (tableName != nullptr)
  {
    children->push_back(tableName);
  }
  if (columnsTerminatedBy != nullptr)
  {
    children->push_back(columnsTerminatedBy);
  }
  if (columnsEnclosedBy != nullptr)
  {
    children->push_back(columnsEnclosedBy);
  }
  if (columnsEscaped != nullptr)
  {
    children->push_back(columnsEscaped);
  }
  if (linesStartingBy != nullptr)
  {
    children->push_back(linesStartingBy);
  }
  if (linesTerminatedBy != nullptr)
  {
    children->push_back(linesTerminatedBy);
  }
  if (ignoreLinesNumber != nullptr)
  {
    children->push_back(ignoreLinesNumber);
  }
  return children;
}

SQLExpr_list_ptr MySqlLoadDataInFileStatement::getColumns()
{
  return columns;
}

void MySqlLoadDataInFileStatement::setColumns(SQLExpr_list_ptr columns)
{
  this->columns = columns;
}

void MySqlLoadDataInFileStatement::setSetList(SQLExpr_list_ptr setList)
{
  this->setList = setList;
}
